{include file="public_head" /}

<!-- datatables -->
<link href="__STATIC__/js/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<!-- Select2 -->
<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">
<!-- chk_3 -->
<link href="__STATIC__/css/chk_3.css" rel="stylesheet" type="text/css"/>

<body class="nav-md">

<div class="container body">


    <div class="main_container">

        {include file="public_sidebar,public_nav" /}

        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left">
                        <h3>
                            店铺统计
                        </h3>
                    </div>
                </div>
                <div class="clearfix"></div>

                <div class="row">

                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_title">
                                <h2>{$mate_title}
                                    <!--<small>promotion</small>-->
                                </h2>
                                <a style="float: right" onclick="wipe_cache()"
                                   class="btn btn-success btn-sm">获取最新数据</a>
                                <div class="clearfix"></div>
                            </div>
                            <div class="x_content">

                                <div class="row">
                                    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                                        <div class="tile-stats">
                                            <div class="icon"><i class="fa fa-home"></i>
                                            </div>
                                            <div class="count">{$today_shop} 家</div>

                                            <h3>今日新增店铺数量</h3>
                                        </div>
                                    </div>

                                    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
                                        <div class="tile-stats">
                                            <div class="icon"><i class="fa fa-home"></i>
                                            </div>
                                            <div class="count">{$shop_number} 家</div>

                                            <h3>店铺总数量</h3>
                                        </div>
                                    </div>


                                    <!-- bar chart -->
                                    <div class="col-md-12 col-sm-6 col-xs-12">
                                        <div class="x_panel">
                                            <div class="x_title">
                                                <h2>店铺下单量排行TOP10</h2>
                                                <div class="clearfix"></div>
                                            </div>
                                            <div class="x_content">
                                                <div id="graph_bar" style="width:100%; height:280px;"></div>
                                            </div>
                                        </div>
                                    </div>
                                    <!-- /bar charts -->

                                </div>

                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
        <!-- /page content -->
    </div>

</div>

{include file="public_foot" /}
<!--select-->
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<script src="__STATIC__/js/bootstrap.min.js"></script>
<!-- morris.js -->
<script src="__STATIC__/js/raphael/raphael.min.js"></script>
<script src="__STATIC__/js/moris/morris.min.js"></script>
<!-- layer -->
<script src="__STATIC__/js/layer.js"></script>
{if condition="cache('shop_volume_number') neq ''"}
<script type="text/javascript">

    $(document).ready(function() {
        Morris.Bar({
            element: 'graph_bar',
            data: [
                {foreach :cache('shop_volume_number') as $vo}
                    {device: '{$vo.title}', geekbench: {$vo.number}},
                {/foreach}

            ],
            xkey: 'device',
            ykeys: ['geekbench'],
            labels: ['下单量'],
            barRatio: 0.4,
            barColors: ['#26B99A', '#34495E', '#ACADAC', '#3498DB'],
            xLabelAngle: 35,
            hideHover: 'auto',
            resize: true
        });
    })

    // 清空缓存
    function wipe_cache(){

        var host=window.location.host;

        var check_url="/public/index.php/Client/Statistics/wipe_cache";
        $.getJSON('http://'+host+check_url,function(result){

            if(result == 1){
                window.location.reload();
                layer.msg('更新数据成功');
            }else{
                layer.msg('网络繁忙,请重试');
            }

        });
    }
</script>
{/if}